<%#
 Copyright 2008 Steven Barth <steven@midlink.org>
 Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
 Licensed to the public under the Apache License 2.0.
-%>

<%+header%>

<% 
local uci = require "luci.model.uci".cursor()
local nickname = uci:get("freifunk", "contact", "nickname") or ""
local name = uci:get("freifunk", "contact", "name") or ""
local homepage = uci:get("freifunk", "contact", "homepage") or {}
local mail = uci:get("freifunk", "contact", "mail") or ""
local phone = uci:get("freifunk", "contact", "phone") or ""
local location = uci:get_first("system", "system", "locaton") or uci:get("freifunk", "contact", "location") or ""
local note = uci:get("freifunk", "contact", "note") or ""
local lon = uci:get_first("system", "system", "longitude") or ""
local lat = uci:get_first("system", "system", "latitude") or ""
%>

<h2 name="content"><%:Contact%></h2>

<fieldset xmlns="http://www.w3.org/1999/xhtml" class="cbi-section">
<legend><%:Operator%></legend>
	<div class="table" cellspacing="10" width="100%" style="text-align:left">
		<div class="tr"><div class="th" width="33%"><%:Nickname%>:</div><div class="td"><%=nickname%></div></div>
		<div class="tr"><div class="th" width="33%"><%:Realname%>:</div><div class="td"><%=name%></div></div>
		<div class="tr"><div class="th" width="33%"><%:Homepage%>:</div><div class="td">
			<% for k, v in ipairs(homepage) do %>
			<a href="<%=v%>"><%=v%></a><br />
			<% end %>
		</div></div>
		<div class="tr"><div class="th" width="33%"><%:E-Mail%>:</div><div class="td"><a href="mailto:<%=mail%>"><%=mail%></a></div></div>
		<div class="tr"><div class="th" width="33%"><%:Phone%>:</div><div class="td"><%=phone%></div></div>
	</div>
</fieldset>

<fieldset xmlns="http://www.w3.org/1999/xhtml" class="cbi-section">
<legend><%:Location%></legend>
	<div class="table" cellspacing="10" width="100%" style="text-align:left">
		<div class="tr"><div class="th" width="33%"><%:Location%>:</div><div class="td"><%=location%></div></div>
		<div class="tr"><div class="th" width="33%"><%:Coordinates%>:</div><div class="td"><%=lat%> <%=lon%> (<a href="<%=pcdata(luci.dispatcher.build_url("freifunk/map"))%>"><%:Show on map%>)</a></div></div>
	</div>
</fieldset>

<% if note then %>
<fieldset xmlns="http://www.w3.org/1999/xhtml" class="cbi-section">
<legend><%:Notice%></legend>
	<div class="table" cellspacing="10" width="100%" style="text-align:left">
		<div class="tr"><div class="td"><%=note%></div></div>
	</div>
</fieldset>
<%end%>

<%+footer%>
